package com.qianda.qdminiapp.domain.model.order;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author cw
 * @since 2019-08-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class QqdOrderLogs extends Model<QqdOrderLogs> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "order_log_id", type = IdType.AUTO)
    private Long orderLogId;

    private String orderLogOrderId;

    private LocalDateTime orderLogCreateTime;

    private String orderLogCmd;

    private String orderLogErrorCode;

    private String orderLogReturnInfo;

    private String orderLogPayNo;

    private String orderLogRemoteAddr;


    public QqdOrderLogs() {
    }

    public QqdOrderLogs(String settingCommand,String orderLogOrderId) {
        int result = 1;
        String[] commands = null;
        commands = settingCommand.split("\\|");
        this.orderLogOrderId = orderLogOrderId;
        this.orderLogCreateTime = LocalDateTime.now();
        this.orderLogCmd =commands[0];
        this.orderLogReturnInfo = settingCommand;
        this.orderLogPayNo = commands[4];
    }

    public QqdOrderLogs(String settingCommand) {
        int result = 1;
        String[] commands = null;
        commands = settingCommand.split("\\|");
        this.orderLogOrderId = commands[1];
        this.orderLogCreateTime = LocalDateTime.now();
        this.orderLogCmd =commands[0];
        this.orderLogErrorCode = commands[2];
        this.orderLogReturnInfo = settingCommand;

    }

    public QqdOrderLogs(String command,String orderLogOrderId,String cmd) {
        this.orderLogCreateTime = LocalDateTime.now();
        this.orderLogOrderId = orderLogOrderId;
        this.orderLogCmd = cmd;
    }

    @Override
    protected Serializable pkVal() {
        return this.orderLogId;
    }

}
